
using System;
using System.Collections.Generic;
using System.Globalization;

namespace ScrewTurn.Wiki.PluginFramework {

	/// <summary>
	/// Represents a Navigation Path.
	/// </summary>
	[Serializable]
	public class NavigationPath {

		private string name;
		private List<string> pages;
		private IPagesStorageProvider provider;

		/// <summary>
		/// Initializes a new instance of the <b>NavigationPath</b> class.
		/// </summary>
		/// <param name="name">The Name of the Navigation Path.</param>
		/// <param name="provider">The Provider</param>
		public NavigationPath(string name, IPagesStorageProvider provider) {
			this.name = name;
			this.provider = provider;
			pages = new List<string>();
		}

		/// <summary>
		/// Gets or sets the Name.
		/// </summary>
		public string Name {
			get { return name; }
			set { name = value; }
		}

		/// <summary>
		/// Gets the Pages of the Path.
		/// </summary>
		public List<string> Pages {
			get { return pages; }
		}

		/// <summary>
		/// Gets the Provider.
		/// </summary>
		public IPagesStorageProvider Provider {
			get { return provider; }
		}

	}

	/// <summary>
	/// Compares two NavigationPaths objects.
	/// </summary>
	public class NavigationPathComparer : IComparer<NavigationPath> {

		/// <summary>
		/// Compares two Navigation Paths's Names.
		/// </summary>
		/// <param name="x">The first object.</param>
		/// <param name="y">The second object.</param>
		/// <returns>The result of the comparison (1, 0 or -1).</returns>
		public int Compare(NavigationPath x, NavigationPath y) {
			return StringComparer.OrdinalIgnoreCase.Compare(x.Name, y.Name);
		}

	}

}
